package com.gzxw.mogublog.commons.exception;

import com.gzxw.mogublog.utils.R;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;
/*
全局异常处理器
 */

@RestControllerAdvice
public class GlobalExceptionHandler {


    @ExceptionHandler(RuntimeException.class)
    public R runtimeException(RuntimeException e) {
        System.out.println(e.getMessage());
        return R.error("500", e.getMessage());
    }

}
